package com.qi.spzx.manager.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qi.spzx.model.dto.system.SysUserDto;
import com.qi.spzx.model.entity.system.SysUser;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface SysUserMapper extends BaseMapper<SysUser> {

    /**
     * 根据用户名查询用户数据
     * @param userName
     * @return
     */
    abstract SysUser selectByUserName(String userName) ;

    /**
     * 进行分页查询
     * @param sysUserDto
     * @return
     */
    List<SysUser> findByPage(SysUserDto sysUserDto);

    /**
     * 进行用户保存
     * @param sysUser
     */
    void saveSysUser(SysUser sysUser);

    /**
     * 用户的修改
     * @param sysUser
     */
    void updateSysUser(SysUser sysUser);

    @Update("update sys_user set is_deleted = 0 and update_time = now() where id = #{userId}")
    void deleteById(Long userId);
}